<?php
/**
 * -----------------------------------------------------
 *
 * models Loginlog_model
 *
 * @package     models
 * @subpackage  
 * @category    login_log_model
 * @author      ChenFu
 * @since       2013-11-29 version 1.0       
 * -----------------------------------------------------    
 */
class Login_model extends CI_Model
{
	public function __construct()
	{
		parent::__construct();
        $this->load->database();
	}  

	/**
	 * 增加登录记录
	 */
	public function insert($data)
	{
		if($this->db->insert('xc_login_logs',$data)){
			return true;
		}else{
			return false;
		}
	}
	
	/**
	 * 查询所有记录
	 */
	public function get_all_login_log($limit)
	{
		$sql = "select * from xc_login_logs order by log_id desc ".$limit;
		$query = $this->db->query($sql);
		if($query->num_rows()){
			return $query->result_array();
		}
	}

	/**
	 * 查询共有多少条数据
	 */
	public function get_all_num()
	{
		$query = $this->db->get('xc_login_logs');
		return $query->num_rows();
	}
}